<?php if (!defined('THINK_PATH')) exit(); /*a:3:{s:50:"./application/admin/template/ad_position\index.htm";i:1585028280;s:78:"D:\phpstudy\PHPTutorial\WWW\ejs86\application\admin\template\public\layout.htm";i:1585028281;s:78:"D:\phpstudy\PHPTutorial\WWW\ejs86\application\admin\template\public\footer.htm";i:1585028281;}*/ ?>
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <link rel="stylesheet" href="/public/plugins/layui/css/layui.css?v=<?php echo $version; ?>" media="all">
  <link rel="stylesheet" href="/public/static/admin/css/admin.css?v=<?php echo $version; ?>" media="all">
  <link rel="stylesheet" href="/public/static/admin/css/ey_layui.css?v=<?php echo $version; ?>" media="all">
  <link rel="stylesheet" href="/public/static/admin/font/ali-font/iconfont.css?v=<?php echo $version; ?>" media="all">
  <script type="text/javascript">
    var eyou_basefile = window.location.pathname;
    var module_name = "<?php echo MODULE_NAME; ?>";
    var __root_dir__ = "";
  </script>  
  <script type="text/javascript" src="/public/static/admin/js/jquery.js?v=<?php echo $version; ?>"></script>
  <script type="text/javascript" src="/public/static/admin/js/jquery-ui/jquery-ui.min.js?v=<?php echo $version; ?>"></script>
  <script type="text/javascript" src="/public/plugins/layer-v3.1.0/layer.js?v=<?php echo $version; ?>"></script>
  <script type="text/javascript" src="/public/static/admin/js/jquery.cookie.js?v=<?php echo $version; ?>"></script>
  <script type="text/javascript" src="/public/plugins/laydate/laydate.js?v=<?php echo $version; ?>"></script>
  <script src="/public/plugins/layui/layui.js?v=<?php echo $version; ?>"></script>
  <script src="/public/static/admin/js/global.js?v=<?php echo $version; ?>"></script>
</head>

<body>
<link rel="stylesheet" href="/public/static/admin/css/page.css" media="all">

<div class="layui-fluid" id="LAY-component-layer-list">
    <div class="layui-card">
        <div class="head-oper">
            <div class="fl">
                <?php if(is_check_access(CONTROLLER_NAME.'@add') == '1'): ?>
                <a data-url="<?php echo url('AdPosition/add'); ?>" data-type="AdPosition_add" class="layui-btn mt5 ">新增广告</a>
                <?php endif; ?>
            </div>
            <div class="fr">
                <form action="<?php echo url('AdPosition/index'); ?>" method="get" onsubmit="layer_loading();">
                    <div class="fl mt5" >
                        <div class="layui-input-inline w240">
                            <?php echo (isset($searchform['hidden']) && ($searchform['hidden'] !== '')?$searchform['hidden']:''); ?>
                            <input type="hidden" name="pid" id="pid" value="<?php echo (\think\Request::instance()->param('pid') ?: ''); ?>">
                            <input type="text" name="keywords" id="keywords" value="<?php echo \think\Request::instance()->param('keywords'); ?>" placeholder="名称搜索" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-input-inline w50 mt5">
                        <button class="layui-btn input-btn-search" type="submit"><i class="layui-icon layui-icon-search"></i></button>
                    </div>
                </form>
            </div>
        </div>
        <div class="layui-card-body">
            <div class="layui-form layui-border-box layui-table-view house-table" lay-filter="demo" lay-id="admin-arctype" >
                <div class="layui-table-box">
                    <div class="layui-table-body " >
                        <table cellspacing="0" cellpadding="0" border="0" class="layui-table layui-form" style="width: 100%" lay-skin="line">
                            <thead >
                            <tr>
                                <th class="w40 tc">
                                    <div class="layui-table-cell w40 tc laytable-cell-checkbox">
                                        <input type="checkbox"  lay-filter="checkAll" class="checkAll"   lay-skin="primary" >
                                        <div class="layui-unselect layui-form-checkbox" lay-skin="primary"> <i class="layui-icon layui-icon-ok"></i></div>
                                    </div>
                                </th>
                                <th class="w60 tc"> <div class="layui-table-cell w60 tc" ><span>ID</span></div></th>
                                <th class="wauto"> <div class="layui-table-cell wauto"><span>广告名称</span></div></th>
                                <th class="w220 tc"> <div class="layui-table-cell w320 tc"><span>操作</span></div></th>
                            </tr>
                            </thead>
                            <tbody>
                            <?php if(empty($list) || (($list instanceof \think\Collection || $list instanceof \think\Paginator ) && $list->isEmpty())): ?>
                            <tr>
                                <td class="no-data" align="center" axis="col0" colspan="4">
                                    <i class="fa fa-exclamation-circle"></i>没有符合条件的数据
                                </td>
                            </tr>
                            <?php else: if(is_array($list) || $list instanceof \think\Collection || $list instanceof \think\Paginator): if( count($list)==0 ) : echo "" ;else: foreach($list as $k=>$vo): ?>
                            <tr>
                                <td>
                                    <div class="layui-table-cell w40 tc laytable-cell-checkbox">
                                        <input type="checkbox" name="ids[]" value="<?php echo $vo['id']; ?>" lay-filter="ids" lay-skin="primary">
                                    </div>
                                </td>
                                <td><div class="layui-table-cell w60 tc"> <?php echo $vo['id']; ?> </div></td>
                                <td>
                                    <div class="layui-table-cell wauto" title=" ">
                                        <?php if(is_check_access(CONTROLLER_NAME.'@edit') == '1'): ?>
                                        <a href="javascript:void(0);" class="eju-event" data-type="AdPosition_edit" data-url="<?php echo url('AdPosition/edit',array('id'=>$vo['id'])); ?>"><?php echo $vo['title']; ?></a>
                                        <?php else: ?>
                                        <?php echo $vo['title']; endif; ?>
                                    </div>
                                </td>
                                <td>
                                    <div class="layui-table-cell w320 tc right-oper">
                                        <!--<a  href="<?php echo url('AdPosition/region',array('pid'=>$vo['id'])); ?>" class="layui-btn btn-edit customvar_retion" >-->
                                            <!--区域管理-->
                                        <!--</a>-->
                                        <?php if(is_check_access(CONTROLLER_NAME.'@edit') == '1'): ?>
                                        <a data-url="<?php echo url('AdPosition/edit',array('id'=>$vo['id'])); ?>" class="layui-btn btn-edit customvar_edit" data-type="AdPosition_edit">
                                            编辑
                                        </a>
                                        <?php endif; ?>
                                        <a class="layui-btn btn-primary" href="javascript:void(0);" onclick="copyToClipBoard(<?php echo $vo['id']; ?>, 1)">标签调用</a>
                                        <?php if(is_check_access(CONTROLLER_NAME.'@del') == '1'): ?>
                                        <a data-url="<?php echo url('AdPosition/del'); ?>" data-id="<?php echo $vo['id']; ?>" class="layui-btn btn-primary" data-type="AdPosition_del" >
                                            删除
                                        </a>
                                        <?php endif; ?>
                                    </div>
                                </td>
                            </tr>
                            <?php endforeach; endif; else: echo "" ;endif; endif; ?>
                            </tbody>
                        </table>
                    </div>
                </div>
                <div class="layui-table-page footer-oper">
                    <input type="checkbox" lay-filter="checkAll" class="checkAll" lay-skin="primary" >
                    <?php if(is_check_access(CONTROLLER_NAME.'@del') == '1'): ?>
                    <a class="layui-btn layui-btn-primary" data-type="batch_del" data-url="<?php echo url('AdPosition/del'); ?>" style="line-height: 34px;">
                    批量删除
                    </a>
                    <?php endif; ?>
                </div>
                <!--分页-->
            </div>
            <?php echo $page; ?>
        </div>
    </div>
</div>

<script>
    $(function () {
        var openurl = "<?php echo \think\Request::instance()->param('openurl'); ?>";
        if (openurl){
            var iframes = layer.open({
                type: 2,
                title: '新增广告',
                fixed: true, //不固定
                shadeClose: false,
                shade: 0.3,
                content: openurl
            });
            layer.full(iframes);
        }
    });
    layui.config({
        base: '/public/static/admin/' //静态资源所在路径
        ,version: '<?php echo $version; ?>'
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'table'], function(){
        var $ = layui.$
            ,form = layui.form
            ,table = layui.table;

        /* 触发事件 */
        var active = {
            AdPosition_add: function(){
                var iframes = layer.open({
                    type: 2,
                    title: '新增广告',
                    fixed: true, //不固定
                    shadeClose: false,
                    shade: 0.3,
                    content: $(this).data('url')
                });
                layer.full(iframes);
            }
            //编辑广告
            ,AdPosition_edit: function(){
                var iframes = layer.open({
                    type: 2,
                    title: '编辑广告',
                    fixed: true, //不固定
                    shadeClose: false,
                    shade: 0.3,
                    content: $(this).data('url')
                });
                layer.full(iframes);
            }
            ,AdPosition_del: function(){
                delfun(this);
            }
            ,batch_del: function(){
                batch_del(this,'ids');
            }
        };
        $('#LAY-component-layer-list .layui-btn,.eju-event').on('click', function(){
            var type = $(this).data('type');
            active[type] && active[type].call(this);
        });

        // 监听复选框全选
        form.on('checkbox(checkAll)', function(data){
            if (data.elem.checked) {
                $('.checkAll').attr('checked', true);
                $('input[name*=ids]').attr('checked', true);
            } else {
                $('.checkAll').attr('checked', false);
                $('input[name*=ids]').attr('checked', false);
            }
            form.render('checkbox');
        });

        // 监听每行复选框
        form.on('checkbox(ids)', function(data){
            if (data.elem.checked && $('input[name*=ids]:checked').length == $('input[name*=ids]').length) {
                $('.checkAll').attr('checked', true);
            } else {
                $('.checkAll').attr('checked', false);
            }
            form.render('checkbox');
        });
    });
    /**
     * 代码调用js
     * @param id  id
     * @param limit 条数
     */
    function copyToClipBoard(id, limit) {
        var advstr = "{eju:adv pid='" + id + "'}\r\n   <img src='{$"+"field.litpic}' alt='{$"+"field.title}' />\r\n{/eju:adv";
        var contentdiv = '<div class="dialog_content" style="margin: 0px; padding: 0px;"><dl style="padding:10px 30px;line-height:30px"><dd>标签 adv 调用：</dd>'
        contentdiv += '<textarea rows="4" cols="60" style="width:400px;height:60px;">' + advstr + '}</textarea>'
        contentdiv += '<dd>JavaScript：</dd>'
        contentdiv += '<dd><input type="text" style=" width:400px;" value="<script type=&quot;text/javascript&quot; src=&quot;http://' + '<?php echo \think\Request::instance()->server('http_host'); ?>' + '/index.php?m=api&amp;c=Other&amp;a=other_show&amp;pid=' + id + '&amp;row='+limit+'&quot;><\/script>"></dd>'
        contentdiv += '<dd style="border-top: dotted 1px #E7E7E7; color: #F60;">请将标签adv或JavaScript代码复制并粘贴到对应模板文件中！</dd></dl></div>'
        layer.open({
            title: '代码调用',
            type: 1,
            skin: 'layui-layer-demo',
            area: ['480px', '280px'], //宽高
            content: contentdiv
        });
    }

</script>

</body>
</html>
